package com.bins.langchain.spring.ai.vector.store.service.impl;

import com.bins.langchain.spring.ai.vector.store.service.MilvusService;
import lombok.RequiredArgsConstructor;
import org.springframework.ai.document.Document;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@RequiredArgsConstructor
public class MilvusServiceImpl implements MilvusService {

    private final VectorStore vectorStore;

    private final OllamaChatModel ollamaChatModel;

    @Override
    public String addVector() {
        List<Document> documents = List.of(
                new Document("1", "Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!!", Map.of("meta1", "meta1")),
                new Document("The World is Big and Salvation Lurks Around the Corner"),
                new Document("2", "You walk forward facing the past and you turn back toward the future.", Map.of("meta2", "meta2")));

        vectorStore.add(documents);
        return "success";
    }
}
